/**
 * 登录
 */
bangkeapp.factory('loginService', ['$http', '$q', 'url', function($http, $q, url) {
    var login = function(login) {
    		
    		var data = {};
		data.request = {};
		data.request.body = {};
		data.request.header = {};
		data.request.body.page = "";
		data.request.body.pagesize = "";
		data.request.body.login = [];
		data.request.body.login[0] = login;
		data.request.header.askSerialNo = "";
		data.request.header.dealCode = "";
		data.request.header.loginComCode = "";
		data.request.header.passWord = "";
		data.request.header.requestType = "";
		data.request.header.sendTime = "";
		data.request.header.systemCode = "";
		data.request.header.userCode = "";
		
        var deferred = $q.defer();
        var promise = deferred.promise;
        var progress;
       
		$http({    
            method: "JSONP",   
            url: url + "/login/get?callback=JSON_CALLBACK",  
            params: {
				"body": angular.toJson(data)
			}
		}).success(function(response) {
			alert(angular.toJson(response));
			var result = response;
			progress = "正确";
			deferred.notify(progress);
			deferred.resolve(result);
			console.log(result);
		})
		.error(function(error) {
			deferred.reject(error);
		});
		return promise;
    }

    return {
        login: login
    };
}]);